package nsd.test.zy03;

public class Rectangle extends Shape{
    private double width;
    private double height;

    public double getWidth() {
        return width;
    }

    public void setWidth(double width) {
        this.width = width;
    }

    public double getHeight() {
        return height;
    }

    public void setHeight(double height) {
        this.height = height;
    }

    public Rectangle() {
    }

    public Rectangle(String color, double width, double height) {
        super(color);
        this.width = width;
        this.height = height;
    }

    @Override
    public double getPer(){
        double per=(height+width)*2;
        return per;
    }
    @Override
    public double getArea(){
        double area=height*width;
        return area;
    }
    @Override
    public void showAll(){
        System.out.println("矩形的周长是："+getPer());
        System.out.println("矩形的面积是："+getArea());
    }


}
